
class Solution
{
public:
    void moveZeroes(vector<int>& nums)
    {
        int l = 0, r = 0;
        while (r < nums.size())
        {
            if (r == l || nums[r] == 0) r++;
            else if (nums[l] != 0) l++;
            else swap(nums[l], nums[r]);
        }
    }
};